package com.huawei.hwid.api.common;

import android.os.Bundle;
import com.huawei.cloudservice.CloudAccount;
import com.huawei.cloudservice.LoginHandler;
import com.huawei.hwid.UseCase.a;
import com.huawei.hwid.core.constants.HwAccountConstants;
import com.huawei.hwid.core.d.b;
import com.huawei.hwid.core.d.b.e;
import com.huawei.hwid.core.datatype.HwAccount;
import com.huawei.hwid.core.helper.handler.ErrorStatus;
import java.util.ArrayList;

class e$2 implements a {
    final /* synthetic */ LoginHandler a;
    final /* synthetic */ String b;

    e$2(LoginHandler loginHandler, String str) {
        this.a = loginHandler;
        this.b = str;
    }

    public void a(Bundle bundle) {
        if (bundle != null) {
            ArrayList parcelableArrayList = bundle.getParcelableArrayList(HwAccountConstants.ACCOUNT_KEY);
            if (parcelableArrayList == null || parcelableArrayList.isEmpty()) {
                e.b("CloudAccountImpl", "has no accounts", true);
                this.a.onFinish(null);
                return;
            }
            HwAccount hwAccount = (HwAccount) parcelableArrayList.get(0);
            if (!b.b(hwAccount)) {
                e.b("CloudAccountImpl", "hwid is not exit", true);
                this.a.onError(new ErrorStatus(31, "hwid is not login"));
                return;
            } else if (hwAccount.d().equalsIgnoreCase(this.b)) {
                CloudAccount[] cloudAccountArr = new CloudAccount[1];
                e eVar = new e();
                e.a(eVar, hwAccount);
                cloudAccountArr[0] = new CloudAccount(eVar);
                this.a.onFinish(cloudAccountArr);
                return;
            } else {
                e.b("CloudAccountImpl", "this userid has no accounts ", true);
                this.a.onFinish(null);
                return;
            }
        }
        this.a.onFinish(null);
    }

    public void b(Bundle bundle) {
    }
}
